package cn.lianyutiantang.mybasecloud.service.impl;


import cn.lianyutiantang.mybasecloud.dao.UserDao;
import cn.lianyutiantang.mybasecloud.entity.UserEntity;
import cn.lianyutiantang.mybasecloud.service.UserService;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

@Service
@Slf4j
public class UserImplService  implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public Map<String, Object> getUserObject(@RequestParam("userId") String userId) {
        Map map = new HashMap();
        map.put("userId",userId);
        map.put("userName","lianyutiantang");
        map.put("msg","调用成功！");
        UserEntity userEntity=userDao.findByID(Long.parseLong(userId));
        log.info("获取到的用户对象为： "+JSON.toJSONString(userEntity));
        map.put("user",userEntity);
        return map;
    }

}
